package main

import (
	"fmt"
	_ "gdshop-admin-go-api/boot"
	_ "gdshop-admin-go-api/router"
	"github.com/gogf/gcache-adapter/adapter"
	"github.com/gogf/gf/encoding/gjson"
	"github.com/gogf/gf/frame/g"
)

func main() {
	s := g.Server()
	//s.SetPort(8001)
	// 平滑重启，win不支持，先屏蔽掉
	//s.EnableAdmin()

	encode, err := gjson.Encode(g.Cfg().GetMap("redis"))
	if err != nil {
		return
	}
	fmt.Println(string(encode))

	adapterRedis := adapter.NewRedis(g.Redis())
	g.DB().GetCache().SetAdapter(adapterRedis)

	s.Start()
	staticServer := g.Server("static")
	staticServer.SetIndexFolder(true)
	staticServer.SetServerRoot(g.Cfg().GetString("upload.WwwrootPath"))
	staticServer.SetPort(8802)
	staticServer.Start()
	g.Wait()
}
